﻿/*
 * Created by SharpDevelop.
 * User: w17338
 * Date: 2015-11-23
 * Time: 19:09
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO.Ports;			//串口

namespace Comm
{
	/// <summary>
	/// Description of Form1.
	/// </summary>
	public partial class ConfigForm : Form
	{
		public ConfigForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
			commNo.Items.AddRange(SerialPort.GetPortNames());
		}
		
		
		void CommNoSelectedIndexChanged(object sender, EventArgs e)
		{
			
		}
		
		void Label1Click(object sender, EventArgs e)
		{
			
		}
		
		void Button1Click(object sender, EventArgs e)
		{
			MyCommClass.PortName = commNo.Text;
			MyCommClass.BaudRate = Convert.ToInt32(comBaudRate.Text);
			MyCommClass.ByteSize = Convert.ToByte(comDataBit.Text);
			MyCommClass.Parity = Convert.ToByte(comParity.SelectedIndex);
			MyCommClass.StopBits = Convert.ToByte(comStopBit.SelectedIndex);
			
			MyCommClass.Configed = true;
     
			this.Hide();
		}
	}
}
